import java.util.ArrayList;
import java.io.Serializable;

public class ChatMessage implements Serializable {
  public long messID;
  public int type;
  public String payload;
  public ArrayList<ChatClientRecord> groupList;
  public ChatClientRecord clientRec;
  public static final int REG_ATTEMPT = 0;//registration attempt -- sent from client to server
  public static final int REG_LEAVE = 1;//user 'clientRec' is leaving the chatroom
  public static final int REG_SUCCESS = 2;//registration successful -- returns the chat room grouplist
  public static final int REG_FAIL = 3;//registration failed
  public static final int HEARTBEAT = 4;//heartbeat -- sent from client to server
  public static final int GET_LIST = 5;//request chat room grouplist -- sent from client to server requesting an updated grouplist. 
  public static final int IM = 6;//plain text chat message

  public ChatMessage(int type, String payload, ArrayList<ChatClientRecord> groupList, ChatClientRecord clientRec) {
    this.messID = -1;
    this.type = type;
    this.payload = payload;
    this.groupList = groupList;
    this.clientRec = clientRec;
  }

  public boolean equals(Object o){
    ChatMessage m = (ChatMessage)o;
    return (m.messID == this.messID);
  }
}
